<template>
  <div className="app-container">
    <div className="table-container">
      <base-list
        ref="table"
        url="/occupation_info"
        :options="options"
        :columns="columns"
        :format="format"
        :rules="rules"
        tree-table
        permission="ADMIN"
        @reloadOptions="handleGetOptions"
      />
    </div>
  </div>
</template>

<script>
import {getBaseList, getBaseOptions} from '@/api/common'
import BaseList from '@/components/BaseList/index.vue'

export default {
  name: 'BannerInfo',
  components: {BaseList},
  data() {
    return {
      columns: [
        {show: true, edit: true, width: 'auto',minWidth: '300', key: 'name', label: '名称', tooltip: '名称', align: 'left', type: 'WORD', queryable: true, sortable: true},
        {show: true, edit: false, width: 'auto',minWidth: '300', key: 'id', label: 'ID', tooltip: 'ID', align: 'center', type: 'WORD', queryable: true, sortable: true},
      ],
      format: {},
      rules: {
        add: {
          name: [{required: true, message: '名称必填!', trigger: 'blur'}],
        },
        edit: {
          id: [{required: true, message: '请选择数据!', trigger: 'change'}],
          name: [{required: true, message: '名称必填!', trigger: 'blur'}],

        }
      },
      options: {
      }
    }
  },

  created() {
    this.handleGetOptions()
  },
  mounted() {
  },
  methods: {
    handleGetOptions() {
      const options = JSON.parse(localStorage.getItem('allOptions'))
      if (options) {
        this.options = Object.assign(this.options, options)
      }
    }
  }
}
</script>


